package com.service;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;

import com.dao.UserDao;
import com.pojo.User;
import com.util.sqlSessionFactory;

public class UserService {
	SqlSession sql = sqlSessionFactory.getSqlSession();
	UserDao dao = sql.getMapper(UserDao.class);

	public User queryone(@Param("account") String account,
			@Param("password") String password) {
		return dao.queryone(account, password);
	}

	public Map<String, Object> querynickname(@Param("id") String id) {
		return dao.querynickname(id);
	}

	public void add(@Param("account") String account,
			@Param("password") String password,
			@Param("nickname") String nickname) {
		dao.add(account, password, nickname);
		sql.commit();
	}

	public List<User> query(@Param("account") String account) {
		return dao.query(account);
	}
}
